Telegram Group & Telegram Channel
📊 Своя метрика в Prometheus

Хотите отслеживать, сколько запросов прилетает в ваше приложение? Или сколько задач выполнилось? Делается это за 5 шагов — через кастомные метрики.

Попробуем реализовать пример: считаем количество HTTP-запросов в приложении на Go.

1. Подключаем библиотеку Prometheus:
go get github.com/prometheus/client_golang/prometheus


2. Создаём счётчик:
var requestCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "myapp_http_requests_total",
Help: "Total number of HTTP requests",
})


3. Регистрируем метрику:
func init() {
prometheus.MustRegister(requestCounter)
}


requestCounter будет инкрементироваться при запросе приложения.

4. Добавляем endpoint для Prometheus:
http.Handle("/metrics", promhttp.Handler())
log.Fatal(http.ListenAndServe(":8080", nil))


5. Пишем конфиг на стороне Prometheus
scrape_configs:
- job_name: 'myapp'
metrics_path: /metrics
static_configs:
- targets: ['localhost:8080']


📍 Всё — теперь http://localhost:8080/metrics отдаёт данные, которые можно добавить в дашборд в Prometheus.

🐸Библиотека devops'a #буст
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/devopsslib/3737
Create:
Last Update:

📊 Своя метрика в Prometheus

Хотите отслеживать, сколько запросов прилетает в ваше приложение? Или сколько задач выполнилось? Делается это за 5 шагов — через кастомные метрики.

Попробуем реализовать пример: считаем количество HTTP-запросов в приложении на Go.

1. Подключаем библиотеку Prometheus:

go get github.com/prometheus/client_golang/prometheus


2. Создаём счётчик:
var requestCounter = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "myapp_http_requests_total",
Help: "Total number of HTTP requests",
})


3. Регистрируем метрику:
func init() {
prometheus.MustRegister(requestCounter)
}


requestCounter будет инкрементироваться при запросе приложения.

4. Добавляем endpoint для Prometheus:
http.Handle("/metrics", promhttp.Handler())
log.Fatal(http.ListenAndServe(":8080", nil))


5. Пишем конфиг на стороне Prometheus
scrape_configs:
- job_name: 'myapp'
metrics_path: /metrics
static_configs:
- targets: ['localhost:8080']


📍 Всё — теперь http://localhost:8080/metrics отдаёт данные, которые можно добавить в дашборд в Prometheus.

🐸Библиотека devops'a #буст

BY Библиотека девопса | DevOps, SRE, Sysadmin




Share with your friend now:
tg-me.com/devopsslib/3737

View MORE
Open in Telegram


Библиотека девопса | DevOps SRE Sysadmin Telegram | DID YOU KNOW?

Date: |

The STAR Market, as is implied by the name, is heavily geared toward smaller innovative tech companies, in particular those engaged in strategically important fields, such as biopharmaceuticals, 5G technology, semiconductors, and new energy. The STAR Market currently has 340 listed securities. The STAR Market is seen as important for China’s high-tech and emerging industries, providing a space for smaller companies to raise capital in China. This is especially significant for technology companies that may be viewed with suspicion on overseas stock exchanges.

Look for Channels Online

You guessed it – the internet is your friend. A good place to start looking for Telegram channels is Reddit. This is one of the biggest sites on the internet, with millions of communities, including those from Telegram.Then, you can search one of the many dedicated websites for Telegram channel searching. One of them is telegram-group.com. This website has many categories and a really simple user interface. Another great site is telegram channels.me. It has even more channels than the previous one, and an even better user experience.These are just some of the many available websites. You can look them up online if you’re not satisfied with these two. All of these sites list only public channels. If you want to join a private channel, you’ll have to ask one of its members to invite you.

Библиотека девопса | DevOps SRE Sysadmin from us


Telegram Библиотека девопса | DevOps, SRE, Sysadmin
FROM USA